Những câu hỏi liên quan
huỳnh duy cát
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 3 2021 lúc 19:53

a)

uses crt;

var i,n:integer;

begin

clrscr;

repeat

write('Nhap n='); readln(n);

until n<100;

if n mod 2=0 then 

begin

for i:=0 to n do 

  if i mod 2=0 then write(i:4);

end

else writeln(n,' khong la so chan');

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
20 tháng 3 2021 lúc 19:53

b)

uses crt;

var i,n:integer;

begin

clrscr;

repeat

write('Nhap n='); readln(n);

until n<100;

if n mod 2=1 then 

begin

for i:=1 to n do 

  if i mod 2=1 then write(i:4);

end

else writeln(n,' khong la so le');

readln;

end.

Bình luận (0)
Phan Thị Ka
Xem chi tiết
Minh Lệ
19 tháng 3 2023 lúc 22:40

Câu 1:

Program HOC24;

var i,p: integer;

t: longint;

begin

write('Nhap P: '); readln(p);

t:=0;

for i:=1 to p do if i mod 2<>0 then t:=t+i;

write('Tong cac so le la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:41

Câu 2:

Program HOC24;

var i,n: integer;

t: longint;

begin

write('Nhap N: '); readln(n);

t:=0;

for i:=1 to n do if i mod 2=0 then t:=t+i;

write('Tong cac so chan la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:42

Câu 3:

Program HOC24;

var i,t,n: integer;

begin

write('Nhap N: '); readln(n);

t:=0;

for i:=1 to n do if n mod i=0 then t:=t+i;

write('Tong cac uoc cua ',n,' la: ',t);

readln

end.

Bình luận (0)
Selena Flynn
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 23:03

c1: 

#include <bits/stdc++.h>

using namespace std;

long long i,n,s;

int main()

{

cin>>n;

s=1;

for (i=1; i<=n; i++) s=s*i;

cout<<s;

return 0;

}

Câu 2: 

#include <bits/stdc++.h>

using namespace std;

long long i,n,s;

int main()

{

cin>>n;

s=1;

for (i=1; i<=n; i++) if (i%2==0) s=s*i;

cout<<s;

return 0;

}

Bình luận (0)
Bùi Lê Thanh Trúc
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 4 2022 lúc 8:21

uses crt;

var n,i,t,s:integer;

begin

clrscr;

repeat

readln(n);

until n<>0;

t:=0;

for i:=1 to n do if i mod 2=0 then t:=t+i;

writeln(t);

s:=1;

for i:=1 to n do 

  if i mod 2=1 then s:=s*i;

writeln(s);

readln;

end.

Bình luận (0)
DinoDrang
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 2 2023 lúc 15:38

uses crt;

var n,i,t:integer;

begin

clrscr;

readln(n);

t:=0;

for i:=1 to n do

if i mod 2=0 then t:=t+i;

write(t);

readln;

end.

Bình luận (0)
Nguyễn Phạm Như Quỳnh
Xem chi tiết
thik
Xem chi tiết
Phía sau một cô gái
3 tháng 4 2023 lúc 22:02

program Chan_Le;

var

     n, i: integer;

begin

     write('Nhap vao so nguyen N: ');

     readln(n);

     writeln('Cac so chan tu 1 den ', n, ' la:');

     for i := 2 to n do

     begin

          if i mod 2 = 0 then

          begin

               write(i, ' ');

          end;

     end;

     writeln;

     writeln('Cac so le tu 1 den ', n, ' la:');

     for i := 1 to n do

     begin

          if i mod 2 <> 0 then

          begin

               write(i, ' ');

          end;

     end;

     readln;

end.

Bình luận (0)
Nguyễn Hoàng Duy
4 tháng 4 2023 lúc 0:06

program Chan_Le;

var n, i: integer;

begin
  write('Nhap vao so nguyen n: ');
  readln(n);
  writeln('Cac so chan tu 1 den ',n, ' la: ');
  for i := 1 to n do
  begin
    if i mod 2 = 0 then
      write(i, ' ');
  end;
  writeln;
  writeln('Cac so le tu 1 den ', n, ' la: ');
  for i := 1 to n do
  begin
    if i mod 2 <> 0 then
      write(i, ' ');
  end;
  readln;
  end.

Bình luận (0)
phạm hương trà
Xem chi tiết
Công Chúa Sakura
4 tháng 1 2017 lúc 22:32

a)

uses crt;

VAR

n, d, i: integer;

BEGIN

clrscr;

Writeln ('Nhap vao n='); readln (n);

d : = 1;

For i: = 1 to n do

d: = d*i;

Writeln ('d=',d);

Readln;

END.

c)

uses crt;

VAR

n, i, demuoc: integer;

BEGIN

clrscr;

Writeln ('Nhap vao n='); readln (n);

demuoc: = 0;

For i: = 1 to n do

If n mod i = 0 then

demuoc : = demuoc + 1;

If demuoc = 2 then

Writeln ('n la so nguyen to')

ELSE

Writeln ('n khong phai la so nguyen to');

Readln ;

END.

Còn phần b bạn tự nghĩ nha!

Chúc bạn học tốt!

Bình luận (0)
San San
Xem chi tiết
Nguyễn Trung Hiếu
20 tháng 3 2022 lúc 7:21

Câu 1: 
uses crt;
var s,i,n:integer;
begin clrscr;
s:=0;
write('Nhap n: ');readln(n);
for i:=1 to n do
if i mod 2 <> 0 then inc(s,i);
write('Tong cac so le tu 1 den ',n,' la: ',s);
readln
end.

Bình luận (0)
Nguyễn Trung Hiếu
20 tháng 3 2022 lúc 7:22

Câu 2:
uses crt;
var s,i,n:integer;
begin clrscr;
s:=0;
write('Nhap n: ');readln(n);
for i:=1 to n do
if i mod 2 = 0 then inc(s,i);
write('Tong cac so le tu 1 den ',n,' la: ',s);
readln
end.

Bình luận (0)